package com.cooldatasoft.dao.impl;

import java.util.List;

import com.cooldatasoft.base.RootDAOImpl;
import com.cooldatasoft.dao.PersonPropertyValueDAO;
import com.cooldatasoft.data.PersonPropertyValue;

public class PersonPropertyValueDAOImpl extends RootDAOImpl<PersonPropertyValue> implements PersonPropertyValueDAO{

	public PersonPropertyValueDAOImpl() {
		super(PersonPropertyValue.class);
	}

	public List<PersonPropertyValue> getPersonPropertyValueList(Integer entityId) {
		return find("from PersonPropertyValue WHERE deleted=false AND personId="+entityId);
	}

	public PersonPropertyValue getValueByPersonId(Integer personId, int personPropertyId) {
		List<PersonPropertyValue> valueList  = find("from PersonPropertyValue WHERE deleted=false AND personId="+personId+" AND personPropertyId="+personPropertyId);
		if(valueList.size()>0){
			return valueList.get(0);
		}else{
			return null;		
		}		
	}

}
